In a Long Term Evolution (LTE) system, a terminal device and a base station perform security operations such as encryption/decryption and integrity protection, to provide encryption protection and integrity protection for signaling. Because different terminal devices have different security capabilities, for example, support different encryption algorithms or integrity protection algorithms, before encryption protection and integrity protection are performed at an access stratum (AS), a set of security algorithms needs to be negotiated between the terminal device and the base station. A process of negotiating the security algorithms includes the following steps:
1. The terminal device sends an attach request to a mobility management entity (MME) by using the base station. The attach request carries an algorithm supported by the terminal device.
2. The base station selects, based on a preconfigured algorithm allowed by a serving network for use and in combination with the algorithm that is supported by the terminal device and that is forwarded by the MME, a security algorithm supported by the serving network. The security algorithm includes an encryption algorithm and an integrity protection algorithm. The base station generates an AS encryption key based on the selected encryption algorithm and generates an integrity protection key based on the integrity protection algorithm. The security algorithm supported by the serving network and selected by the base station is both a security algorithm of a user plane and a security algorithm applied to a signaling plane.
3. By using an AS security mode command (Security mode command, SMC) procedure, the terminal device applies the security algorithm selected by the base station to the user plane and the signaling plane. For example, the encryption algorithm and the integrity protection algorithm selected by the base station are carried in an AS SMC and sent to the terminal device.
In the prior art, the security algorithm applied to both the user plane and the signaling plane is determined by using the AS SMC procedure, and the security algorithm includes the encryption algorithm and the integrity protection algorithm. A negotiation solution of this security algorithm is relatively fixed. For example, a same set of security algorithms is applicable to the user plane and the signaling plane and cannot be split. For another example, the encryption algorithm and the integrity protection algorithm need to be determined at the same time and cannot be split. Therefore, the security negotiation algorithm is relatively fixed, and cannot adapt to flexible and changeable application scenarios.